#include "../afwwin.h"

using namespace one_rag::impl;
using namespace one_rag;

Win32AppWindow::Win32AppWindow()
{
  //ctor
}

Win32AppWindow::~Win32AppWindow()
{
  //dtor
}

bool Win32AppWindow::Create(int x,int y,int w,int h,LPCTSTR strTitle)
{
  return Window::CreateOverlapped(RegisterClass(TEXT("AFWPOPUPWND")),x,y,w,h,strTitle);
}

LRESULT Win32AppWindow::WindowProc(UINT uMsg,WPARAM wParam,LPARAM lParam)
{
  switch(uMsg){
    HWND hwnd;
    int w;
    int h;
    case WM_SIZE:
      if( (hwnd = GetWindow(_wnd,GW_CHILD)))
      {
        w = LOWORD(lParam);
        h = HIWORD(lParam);
        MoveWindow(hwnd,0,0,w,h,TRUE);
      }
      break;
    case WM_DESTROY:
      App::EndRunLoop(0);
      break;
  }

  return Window::WindowProc(uMsg,wParam,lParam);
}
